PATH=D:\Program Files\IAR Systems\Embedded Workbench 6.0 Evaluation\stm8\bin;D:\Program Files\IAR Systems\Embedded Workbench 6.0 Evaluation\common\bin
SET IARSYSTEM="D:\Program Files\IAR Systems\Embedded Workbench 6.0 Evaluation\stm8"

SET TARGET=airtouch_stm8
SET APP_PATH=%cd%
SET OBJ_PATH=%APP_PATH%\Debug\Obj
SET LST_PATH=%APP_PATH%\Debug\List
SET EXE_PATH=%APP_PATH%\Debug\Exe

SET LD_ARCH=--config %IARSYSTEM%\config\lnkstm8s105k6.icf

iarbuild "%TARGET%.ewp" -make Debug -log info

ilinkstm8.exe %OBJ_PATH%\aat4292.o %OBJ_PATH%\adc.o %OBJ_PATH%\i2c.o %OBJ_PATH%\main.o %OBJ_PATH%\matrix.o %OBJ_PATH%\screen.o %OBJ_PATH%\stm8s_adc1.o %OBJ_PATH%\stm8s_clk.o %OBJ_PATH%\stm8s_flash.o %OBJ_PATH%\stm8s_gpio.o %OBJ_PATH%\stm8s_i2c.o %OBJ_PATH%\stm8s_tim2.o %OBJ_PATH%\timer.o --redirect _Printf=_PrintfSmall --redirect _Scanf=_ScanfSmall -o %EXE_PATH%\%TARGET%.out --map %LST_PATH%/%TARGET%.map %LD_ARCH% --config_def _CSTACK_SIZE=0x100 --config_def _HEAP_SIZE=0x100 --entry __iar_program_start --debug_lib
ielftool.exe --srec --verbose %EXE_PATH%\%TARGET%.out %EXE_PATH%\%TARGET%.srec
ielftool.exe --ihex --verbose %EXE_PATH%\%TARGET%.out %EXE_PATH%\%TARGET%.hex
ielftool.exe --bin --verbose %EXE_PATH%\%TARGET%.out %EXE_PATH%\%TARGET%.bin
